NOTE
1.37 MySQL Flush
A page is dirty when its contents in memory differ from those on disk. Flushing writes dirty pages to disk to bring them back into agreement.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is Flush
- When the contents of an in-memory data page and an on-disk data page are inconsistent, we call the memory page a “dirty page.” After the memory data is written to disk, the contents of the memory and disk data pages become consistent, and it is called a “clean page.”
- Flushing means writing dirty pages to disk.
2. When Flush Is Triggered
- When the following situations occur…
- the redo-log is full (try to avoid this, because it blocks all updates);
- memory is full;
- when MySQL considers the system idle (little impact);
- when MySQL shuts down normally (little impact).
Impact of Flush
- MySQL performance fluctuates briefly.
3. InnoDB Dirty-Page Flushing Control Strategy
- First use
fioto measure disk IOPS, then setinnodb_io_capacityto the corresponding value. For example, the original note used the following command for measurement:
fio -filename=$filename -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psync -bs=16k -size=500M -numjobs=10 -runtime=10 -group_reporting -name=mytest
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub